package com.gr.labbackend.controller.editor;

import com.alibaba.fastjson.JSONObject;
import com.gr.labbackend.service.editor.ImageUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class ImageUploadController {

    @Autowired
    private ImageUploadService imageUploadService;

    @PostMapping("/api/upload/image")
    public JSONObject uploadImage(@RequestParam("file") MultipartFile file) {
        return imageUploadService.uploadImage(file);
    }
}
